//package com.emar.adx.yiqifa.thread;
//
//import com.emar.adx.yiqifa.service.FeedbackService;
//import com.emar.adx.yiqifa.util.ConfigurationFactory;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.support.ClassPathXmlApplicationContext;
//
//import java.net.UnknownHostException;
//
///**
// * Created by Administrator on 2015/11/18.
// */
//public class FeedbackThread extends Thread{
//
//    private Logger log = LoggerFactory.getLogger(FeedbackThread.class);
//    private FeedbackService feedbackService = null;
//    private static final long sleepTime =ConfigurationFactory.getConfiguration("config.properties").getLong("sleep.time");;
//
//    public void setFeedbackService(FeedbackService feedbackService) {
//        this.feedbackService = feedbackService;
//    }
//
//    @Override
//    public void run() {
//
//        int skip = ConfigurationFactory.getConfiguration("config.properties").getInt("mongo.skip");
//        int limit = ConfigurationFactory.getConfiguration("config.properties").getInt("mongo.limit");
//        String tableName = ConfigurationFactory.getConfiguration("config.properties").getString("mongo.collectionName");
//
//        long total = feedbackService.getMongoCount(tableName);
//
//        try {
//            while (skip < total) {
//                try{
//                    feedbackService.mongoToMysql(skip, limit, tableName);
//                    skip = limit +skip;
//                    log.info("sync nums = "+skip);
//                }catch (Exception e){
//                    log.error("from "+skip);
//                }
//                Thread.sleep(sleepTime);
//            }
//
//        } catch (Exception e) {
//            log.error("thread id[" + this.getId() + "] import error:", e);
//        }
//    }
//}
